package com.ikas.ai.server.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;

/**
 * 启用定时任务配置
 *
 * @author dbh
 */
@Configuration
@EnableScheduling
//配置文件读取是否启用此配置
@ConditionalOnProperty(prefix = "enable", name = "scheduled", havingValue = "true")
public class SchedulingConfig {

    @Bean
    public ScheduledAnnotationBeanPostProcessor processor() {
        return new ScheduledAnnotationBeanPostProcessor();
    }

}